package cn.byapps.hw.controller;

import cn.byapps.hw.entity.Teacher;
import cn.byapps.hw.service.TimetableService;
import cn.byapps.hw.vo.ClazzTimetableVO;
import cn.byapps.hw.vo.TeacherTimetableVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;

@RestController
@RequestMapping("/api/timetable")
public class TimetableController {

    @Resource
    private TimetableService timetableService;

    @GetMapping
    public List<TeacherTimetableVO> teacherTimetableVOS(Teacher teacher, Integer date) throws ParseException {
        return timetableService.teacherTimetable(teacher, date);
    }

    @GetMapping("/clazztimetable")
    public List<ClazzTimetableVO> clazzTimetableVOS(Integer clazzId, Integer date) throws ParseException {
        return timetableService.clazzTimetable(clazzId, date);
    }
}
